//
//  playingViewController.m
//  liangyi
//
//  Created by 张水 on 16/12/22.
//  Copyright © 2016年 yswh. All rights reserved.
//

#import "playingViewController.h"

@interface playingViewController ()

@property(nonatomic,strong) UIButton *playBtn;

@property(nonatomic,strong) UIImageView *imgView;

@property(nonatomic,strong) UILabel *titleLable;

@end

@implementation playingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor ColorWithHex:@"#56A2AB"];
    [self initUI];
    
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}

-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

-(void)initUI{
    
    self.playBtn = [[UIButton alloc]init];
    [self.view addSubview:self.playBtn];
    [self.playBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view.mas_centerX);
        make.centerY.equalTo(self.view.mas_centerY).offset(-50);
        make.width.height.equalTo(@90);
    }];
    [self.playBtn setBackgroundImage:[UIImage imageNamed:@"done"] forState:UIControlStateNormal];
    [self.playBtn setImage:[UIImage imageNamed:@"play"] forState:UIControlStateNormal];
    [self.playBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 10, 0, 0)];
    [self.playBtn addTarget:self action:@selector(playBtnDidClick) forControlEvents:UIControlEventAllTouchEvents];
    
    UILabel *desLabel = [[UILabel alloc]init];
    [self.view addSubview:desLabel];
    [desLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.playBtn.mas_bottom).offset(20);
        make.centerX.equalTo(self.view.mas_centerX);
    }];
    desLabel.textColor = [UIColor whiteColor];
    desLabel.font = [UIFont systemFontOfSize:20];
    desLabel.text = @"继续播放";
    
    self.imgView = [[UIImageView alloc]init];
    [self.view addSubview:self.imgView];
    [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view.mas_bottom).offset(-140);
        make.centerX.equalTo(self.view.mas_centerX).offset(-60);
        make.width.equalTo(@120);
        make.height.equalTo(@60);
    }];
    self.imgView.layer.borderColor = [UIColor whiteColor].CGColor;
    self.imgView.layer.borderWidth = 1;
    self.imgView.image = [UIImage imageNamed:@"banner"];
    
    self.titleLable = [[UILabel alloc]init];
    [self.view addSubview:self.titleLable];
    [self.titleLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view.mas_bottom).offset(-140);
        make.centerX.equalTo(self.view.mas_centerX).offset(70);
        make.width.equalTo(@140);
        make.height.equalTo(@60);
    }];
    self.titleLable.font = [UIFont systemFontOfSize:20];
    self.titleLable.layer.borderWidth = 1;
    self.titleLable.textAlignment = NSTextAlignmentCenter;
    self.titleLable.textColor = [UIColor whiteColor];
    self.titleLable.layer.borderColor = [UIColor whiteColor].CGColor;
    self.titleLable.backgroundColor = [UIColor ColorWithHex:@"#56A2AB"];
    self.titleLable.text = @"顶医";
}
-(void)loadData:(recoveriesModel *)model{
    self.titleLable.text = model.title;
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",BaseIamgeUrl,model.videoImg]] placeholderImage:[UIImage imageNamed:@"img_placeholder"]];
}
-(void)playBtnDidClick{
    [self dismissViewControllerAnimated:YES completion:nil];
}
@end
